import './assets/main.css'

import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as echarts from 'echarts';

// import VChart from 'vue-echarts';
import { createPinia } from 'pinia'

import axios from 'axios';
axios.defaults.baseURL = 'http://localhost:3000';
axios.interceptors.request.use(config => {
  const token = localStorage.getItem('token');
  if (token) {
      // 如果 token 存在，在每个 HTTP header 都加上 token
      // Bearer 是 JWT 的认证头部信息
      config.headers.Authorization = `Bearer ${token}`;
  }
  return config;
})
axios.interceptors.response.use(config => {
  return config.data;
})
export {axios}




const pinia = createPinia()
import App from './App.vue'
import router from './router'

export const app = createApp(App)
// app.config.globalProperties.$echarts = echarts
// app.component('v-chart', VChart);



app.use(ElementPlus)
app.use(pinia)
app.use(router)
app.mount('#app')
